home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
escalant
/
escala21.lha
/
escalante2.1
/
bin
/
GenericEd.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-14
|
7KB
|
341 lines
#ifndef <PNAME>_First
#define <PNAME>_First
//
//This file contains the classes that make up the language specific
//editor component. The <PNAME>View class contains most of the potential
//functionality. Many of the methods are commented out. They are there to show
//you what can be done. Some of these methods are described here in the .h,
//the others are described in the .C
//
#include "EscalanteView.h"
#include "Escalante.h"
#include "Fields.h"
#include "TextItem.h"
//
//You can make your own timer object. This object gets called backed
//and calls the method Tick(). We have a list of elements alreaady defined here
//if needed.
//
#include "TimerObject.h"
class <PNAME>Timer: public TimerObject{
public:
ObjList * elements;
<PNAME>Timer(bool active = TRUE, int rate = 1):TimerObject(active,rate){
elements = new ObjList();
}
void Add(Object*e) {
if(!elements->ContainsPtr(e))
elements->Add(e);
}
void Remove(Object*e) {elements->Remove(e);}
void Tick();
};
enum <PNAME>MenuIds{
e<PNAME>MENU = cESCALANTELASTMENUID+1,
e<PNAME>HideMenu,
ePullRightMenu
};
enum <PNAME>Actions{
<PNAME>Action1 =ESCALANTEVIEWLASTACTION+1,
<PNAME>Action2,
<PNAME>Action3,
<PNAME>HideLabels,
<PNAME>StepTimer,
<PNAME>ToggleTimer,
#include "<PNAME>HSEnum.h"
//Here is an action include
#include "<PNAME>ActionEnum.h"
};
class Document;
class VObject;
enum <PNAME>ViewFlags{e<PNAME>ViewLast = eEscalanteViewLast};
#define <PNAME>View_BASE EscalanteView
class <PNAME>View: public <PNAME>View_BASE {
public:
MetaDef(<PNAME>View);
<PNAME>View(int id,
Document* doc,
Point pt,
VGraphElement* vg,
bool makePalette = TRUE);
bool SetAction2(Actions m,void* data =0);
Command* DoLeftButtonDownCommand(Point p, Token t, int i);
Command* DoMiddleButtonDownCommand(Point p, Token t, int i);
static Menu* MakeMenu(int );
void DoSetupMenu(class Menu* );
//
//Misc. methods one can use. Any method not described here will probably be
//described in the .C
//
//
//bool NewHeadOk(VRelation* nr,VGraphElement* e);
//bool NewTailOk(VRelation* nr,VGraphElement* e);
//
//
//There is a facility to read/write raw text files.
//Using the actions: WRITE_TEXT_TO_FILE, READ_TEXT_FROM_FILE.
//The following methods are called to get the text associated with the picked
//element and to do somwthing with the text from a reading.
//
//char * GetTextToWrite(VGraphElement*){return 0;}
//void HereIsSomeText(char *,VGraphElement*){}
//You can associate a ObjectGrid with a view. The default id to get the
//grid from the vgraph->GetGrid() method;
ObjectGrid* GetGrid();
//This method is called when this object is an observer of some other object
//void DoObserve(int id, int part, void *d , Object *op);
//
//
//When a key is pressed this method is called
//Command *DoKeyCommand(int key, Token t){
// return <PNAME>_BASE::DoKeyCommand(key,t);
//}
//
//
//char* ActionName(Actions action);
//
//
//void Control(int id, int part, void* val);
//
//void AddToToolList(ObjList* l);
//void SignalError(char* c);
//void ClearError();
//void SignalMode(char* c);
//void ClearMode();
//
//When adding an element using elt as a prototype do we use the multiple
//add command object? This type of add keeps adding objects as long as
//the button is down.
//bool AddMultiples(VGraphElement *elt){return TRUE;}
//
//
//void DoneDrawingRect();
//
//
//ErrorReturn CouldNotFindHead(VRelation*,Set * s=0 );
//ErrorReturn CouldNotFindTail(VRelation*, Set* s = 0 );
//
//
//bool OkToDeleteElement(VGraphElement* );
//void DoneAddingElements(class Set*);
//void DoneAddingElement(VGraphElement* );
//void DoneMovingElement(VGraphElement*);
//
//
//void Draw(Rectangle);
//void DrawGraph(Rectangle r);
//
//
//Misc. methods concerning the palette
//
//
//How big are the palette items
//
// Point GetPaletteItemSize(){return Point(16,16);}
//
//Overrides the ETRC MakeSeparatePalette when it (the ETRC flag ) is FALSE
//
//bool MakeSeparatePalette(){return TRUE;}
//
//Overrides the ETRC MakeExtraPalette when it (the ETRC flag ) is TRUE
//
//bool DoNotMakeExtraPalette(){return TRUE;}
//
//Overrides the ETRC MakePalette when it (the ETRC flag ) is set to false
//
//bool ForceMakePalette(){return TRUE;}
//
//
//Overrides the ETRC MakeObserverView when it (the ETRC flag ) is TRUE
//
// bool DoNotMakeObserverView(){return TRUE;}
//
//
//These methods can be used to define how the palette is set up for this view.
//
//GetOrientation: Where does the palette go? 0->Left,1->Top,2->Right,3->Bottom
//
//int GetOrientation(){return 0;}
//
//How many rows/columns are there in the palette
//
//int GetRows(){return 0;}
//int GetCols(){return 1;}
//
//
//This method can be used to return a list of the prototype objects
//that are placed in the palette. The list is assumed to be made of
//of VGraphElement*. The default behavior is to return the protos list
//contained in the vgraph.
//The virtual method EscalanteView:: MakeToolList() is called when we need to make
//a new palette. If you wanted to change the palette then make the change to your list
//and call MakeToolList. This will update your palette.
//
//ObjList* GetProtoList(){}
//
//
//These methods are all described in the .C
//
//
//void GetNewGraph(VGraphElement * vg,VGraphElement * & newvg);
//
//
//void NewGraph(VGraphElement *, bool push = FALSE);
//
//
//VObject* GetView();
//
//VObject* GetTopVObj();
//VObject* GetBottomVObj();
//
//char* GetDescription();
//char* GetElementDescription(VGraphElement* );
//char* GetActionDescription(Actions);
//
};
#define <PNAME>Document_BASE EscalanteDocument
class <PNAME>Document : public <PNAME>Document_BASE {
public:
MetaDef(<PNAME>Document);
<PNAME>Document(VGraphElement* vg):<PNAME>Document_BASE(vg) {
Manager::SetName("<PNAME> View");
}
EscalanteView* MakeEscalanteView(int,Point,VGraphElement* );
MenuBar* DoMakeMenuBar();
void DoSetupMenu(Menu* );
//
//void Control(int id, int part, void* val);
//
};
#define <PNAME>Manager_BASE EscalanteManager
class <PNAME>Manager : public <PNAME>Manager_BASE {
public:
MetaDef(<PNAME>Manager);
<PNAME>Manager(SGraphElement* sg,
class ObjList* vg,
char* docType =cDocTypeSgVgs ):<PNAME>Manager_BASE(sg,vg,docType){}
EscalanteDocument* MakeEscalanteDocument(VGraphElement* );
};
#define <PNAME>_BASE Escalante
class <PNAME>: public <PNAME>_BASE {
public:
MetaDef(<PNAME>);
<PNAME>(int argc, char* * argv);
void MakeGraph(SGraphElement* & ,ObjList* &);
EscalanteManager* MakeEscalanteManager(SGraphElement* sg,ObjList* vgs);
};
#endif